<template>
	<view>
		用户回访{{title}}
	</view>
</template>

<script>
	const baseUrl = 'http://localhost:9999';
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {
			this.getProducts();
		},
		methods: {
			getProducts() {
			  return new Promise((resolve, reject) => {
			    uni.request({
			      url: `${baseUrl}/hello`,
			      method: 'GET',
			      success: (res) => {
					  console.log(res)
					  this.title = res
			        // if (res.statusCode === 200) {
			        //   resolve(res.data); // 返回获取的数据
			        // } else {
			        //   reject('请求失败');
			        // }
			      },
			      fail: (error) => {
			        reject(error);
			      }
			    });
			  });
			}
		}
	}
</script>

<style lang="scss">

</style>
